package com.wlhse.controller;

import com.wlhse.dto.inDto.*;
import com.wlhse.service.EchartService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("EchartController")
@RequestMapping("/api/v3")
public class EChartController {

    @Resource
    private EchartService echartService;

    //按问题级别
    @RequestMapping(value = "/problem_level_analysis", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryProblemLevelAnalysisInDtoList(@ModelAttribute ProblemLevelAnalysisInDto problemLevelAnalysisInDto) {
        return echartService.getProblemLevelAnalysisOutDtoList(problemLevelAnalysisInDto);
    }

    //问题趋势
    @RequestMapping(value = "/problem_trend", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryProblemTrend(@ModelAttribute ProblemTrendInDto problemTrendInDto) {
        return echartService.getProblemTrendOutDtoList(problemTrendInDto);
    }

    //监督业绩
    @RequestMapping(value = "/oversight_company", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryOversightByCompany(@ModelAttribute OversightInDto oversightInDto) {
        return echartService.getOversightByCompanyOutDto(oversightInDto);
    }

    //监督业绩
    @RequestMapping(value = "/oversight_employee", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryOversightByEmployee(@ModelAttribute OversightInDto oversightInDto) {
        return echartService.getOversightByEmployeeOutDto(oversightInDto);
    }

    //任务工序
    @RequestMapping(value = "/task_process", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryTaskAndProcess(@ModelAttribute OversightInDto oversightInDto) {
        return echartService.getEchartTaskAndProcessOutDto(oversightInDto);
    }

    //按责任人
    @RequestMapping(value = "/response_employee", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryResponseEmp(@ModelAttribute OversightInDto oversightInDto) {
        return echartService.getEchartResponseEmp(oversightInDto);
    }

    //按单位分析
    @RequestMapping(value = "/company_problem_analysis", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryResponseEmp(@ModelAttribute CompanyProblemAnalysisInDto companyProblemAnalysisInDto) {
        return echartService.getCompanyProblemAnalysis(companyProblemAnalysisInDto);
    }

    //指标体系
    @RequestMapping(value = "/index_system", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryIndexSystem(@ModelAttribute IndexSystemInDto indexSystemInDto) {
        return echartService.getIndexSystemOutDto(indexSystemInDto);
    }

    //根据月份，分析今年和去年的事故事件
    @RequestMapping(value = "/accident_month", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getAccidentRecordByMonth(@ModelAttribute CompanyProblemAnalysisInDto companyProblemAnalysisInDto) {
        return echartService.getAccidentRecordByMonth(companyProblemAnalysisInDto);
    }

    //根据类别分析事故事件
    @RequestMapping(value = "/accident_type", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getAccidentRecordByType(@ModelAttribute CompanyProblemAnalysisInDto companyProblemAnalysisInDto) {
        return echartService.getAccidentRecordByType(companyProblemAnalysisInDto);
    }

    //根据公司分析事故事件
    @RequestMapping(value = "/accident_company", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getAccidentRecordByCom(@ModelAttribute CompanyProblemAnalysisInDto companyProblemAnalysisInDto) {
        return echartService.getAccidentRecordByCom(companyProblemAnalysisInDto);
    }
    //根据月份，分析今年和去年的事故事件、问题
    @RequestMapping(value = "/count_month", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getCountRecordByMonth(@ModelAttribute CompanyProblemAnalysisInDto companyProblemAnalysisInDto) {
        return echartService.getCountRecordByMonth(companyProblemAnalysisInDto);
    }
    //根据公司分析事故事件数量
    @RequestMapping(value = "/counts", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String getCountAccident(@RequestParam("pageName") String pageName) {
        return echartService.getCountAccident(pageName);
    }
}
